# 版本信息
FROM centos
MAINTAINER guoxiaolin "gxl@callbell.cn"

# OS环境配置
RUN yum install -y wget

# 安装JDK
#创建jdk存放目录
RUN mkdir /var/tmp/jdk  
#将压缩文件添加到JDK存放目录
COPY ./jdk/  /var/tmp/jdk
#进入jdk存放目录
RUN cd /var/tmp/jdk
#解压jdk存放目录下的jdk.tar文件
RUN tar xzf /var/tmp/jdk/jdk-8u162-linux-x64.tar.gz -C /var/tmp/jdk

#RUN wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"  -P /var/tmp/jdk http://download.oracle.com/otn-pub/java/jdk/8u111-b14/jdk-8u111-linux-x64.tar.gz
#RUN tar xzf /var/tmp/jdk/jdk-8u111-linux-x64.tar.gz -C /var/tmp/jdk && rm -rf /var/tmp/jdk/jdk-8u111-linux-x64.tar.gz


# 安装tomcat
RUN mkdir /var/tmp/tomcat
COPY ./tomcat/  /var/tmp/tomcat
RUN cd /var/tmp/tomcat
RUN tar xzf /var/tmp/tomcat/apache-tomcat-8.5.30.tar.gz -C /var/tmp/tomcat 

#RUN wget -P  /var/tmp/tomcat http://archive.apache.org/dist/tomcat/tomcat-8/v8.5.8/bin/apache-tomcat-8.5.8.tar.gz
#RUN tar xzf /var/tmp/tomcat/apache-tomcat-8.5.8.tar.gz -C /var/tmp/tomcat && rm -rf /var/tmp/tomcat/apache-tomcat-8.5.8.tar.gz

#设置环境变量jdk1.8.0_162
ENV JAVA_HOME /var/tmp/jdk/jdk1.8.0_162
ENV CATALINA_HOME /var/tmp/tomcat/apache-tomcat-8.5.30
ENV PATH $PATH:$JAVA_HOME/bin:$CATALINA_HOME/bin

#打包项目并拷贝到tomcat webapps目录
RUN mkdir /var/tmp/webapp
COPY ./war/  /var/tmp/webapp
RUN cd /var/tmp/webapp
RUN cp /var/tmp/webapp/wen-wan-server.war /var/tmp/tomcat/apache-tomcat-8.5.30/webapps/ -r


#开启内部服务端口
EXPOSE 8080

#启动tomcat服务器
CMD /var/tmp/tomcat/apache-tomcat-8.5.30/bin/startup.sh
#CMD ["./var/tmp/tomcat/apache-tomcat-8.5.30/bin/catalina.sh","run"] && tail -f /var/tmp/tomcat/apache-tomcat-8.5.30/logs/catalina.out 